#include "..\utils.h"
#include <fstream>
using namespace std;
int p[1010];
// k组数据的n
int nArr[10] = {5, 5, 20, 20, 50, 50, 200, 200, 1000, 1000};

int main(){
  srand(time(0));
  // 随机生成k组数据，放在k个in文件里
  for(int k = 1; k <= 10; k++){
    int n = nArr[k - 1];

    // 文件流
    string optFile = to_string(k) + ".in";
    ofstream fout = createOutputFStream(optFile);

    vector<pair<int, int>> g = randomGraph(n, 0.9);
    int m = g.size();

    // 生成第一行和第二行数据
    fout << n << " " << m  << " " << randomInt(1, n) << endl;
    for(int i = 1; i <= n; i++){
      fout << randomInt(0, 100) << " ";
    }
    fout << endl;

    // 生成后面的m行数据
    for(int i = 1; i <= n; i++){
      p[i] = 100;
    }
    for(auto i : g){
      int pi = randomInt(0, p[i.first]);
      p[i.first] -= pi;
      fout << i.first << " " << i.second << " " << pi << endl;
    }
    fout.close();
  
  }
}